package com.weijx.dishes.service.impl;

import com.weijx.dishes.entity.Category;
import com.weijx.dishes.mapper.CategoryMapper;
import com.weijx.dishes.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * com.weijx.dishes.service.impl.CategoryServiceImpl
 * 描述：
 * on 2025/10/24-下午3:44
 *
 * @author weijx
 */

@Service
public class CategoryServiceImpl implements CategoryService {

    @Resource
    private CategoryMapper categoryMapper;

    @Override
    public List<Category> getAllCategories() {
        return categoryMapper.selectAllCategories();
    }

    @Override
    public List<Category> getCategoriesByParentId(String parentId) {
        return categoryMapper.selectByParentId(parentId);
    }

    @Override
    public Category getCategoryById(String id) {
        return categoryMapper.selectById(id);
    }
}
